import request from '@/utils/request'

export function getTemplateList(param) {
  return request({
    url: '/template/list',
    method: 'post',
    params: param
  })
}

export function getTemplateDetail(id) {
  return request({
    url: '/template/detail/' + id,
    method: 'post'
  })
}

export function getQuestionByTemplate(param) {
  return request({
    url: '/r-template-questions-list/getQuestionList',
    method: 'post',
    params: param
  })
}

export function getArticleByTemplate(param) {
  return request({
    url: '/r-template-articles-list/getArticleList',
    method: 'post',
    params: param
  })
}

export function removeQuestionByTemplate(data) {
  return request({
    header: {
      'Content-Type': 'application/json'
    },
    url: '/r-template-questions-list/remove',
    method: 'post',
    data
  })
}

export function addArticlesByTemplate(param) {
  return request({
    url: '/r-template-articles-list/add',
    method: 'post',
    params: param
  })
}

export function downLoadTemplate() {
  return request({
    responseType: 'blob',
    url: '/template/download',
    method: 'post'
  })
}
